package cn.buk.tms.dao;

import cn.buk.tms.sc.SearchCustomerCriteria;
import cn.buk.tms.entity.misc.*;

import java.util.List;
import java.util.Map;

/**
 * @author yfdai
 */
public interface CustomerDao {

	int create(Customer customer);

	int update(Customer customer);

	int delete(int id);

	Customer getCustomerById(int id, boolean forceRefresh);

	/**
	 * 根据ID获取企业客户信息
	 * @param id 客户id
	 * @return
	 */
	Customer getCustomerById(int id);

	Customer getCustomerByCustomerEnterpriseId(int enterpriseId, int customerEnterpriseId);

	List<Customer> searchCustomer(SearchCustomerCriteria sc);

	List<Customer> searchCustomerByCustomerName(final int enterpriseId, final String customerName);

	List<Customer> getAllCustomers(int enterpriseId);

	Map<Integer, Customer> getCustomerSets(int enterpriseId);

	List<Customer> searchCustomers(int enterpriseId, SearchCustomerCriteria sc, List<Integer> allowedCustomerIds);

	List<Customer> searchCustomerByCustomerEnterpriseId(int enterpriseId, int customerEnterpriseId);

  List<CustomerTravelZone> searchCustomerTravelZones(int enterpriseId, SearchCustomerCriteria sc);

	/**
	 * 从地区分类中移除某城市
	 * @param enterpriseId
	 * @param username
	 * @param customerId
	 * @param zoneId
	 * @param cityId
	 * @return
	 */
	int removeCustomerTravelZone(int enterpriseId, String username, int customerId, int zoneId, int cityId);

	int addCustomerTravelZone(int enterpriseId, String username, int customerId, int zoneId, int cityId);

	CustomerTravelZone getTravelZoneByCityId(int enterpriseId, int customerId, int cityId);

  CustomerPosition getCustomerPositionById(int id);

	int saveCustomerTpHotel(int enterpriseId, String username, CustomerTpHotel tpHotel);

	List<CustomerTpHotel> searchCustomerTpHotels(int enterpriseId, SearchCustomerCriteria sc);
	List<CustomerTpHotel> searchCustomerTpHotels(int enterpriseId, int customerId);

	int deleteCustomerTpHotel(int enterpriseId, String username, int customerId, int id);

  int saveCustomerTpFlight(int enterpriseId, String username, CustomerTpFlight tpFlight);

	List<CustomerTpFlight> searchCustomerTpFlights(int enterpriseId, SearchCustomerCriteria sc);
	List<CustomerTpFlight> searchCustomerTpFlights(int enterpriseId, int customerId);

	int deleteCustomerTpFlight(int enterpriseId, String username, int customerId, int id);

  int saveCustomerTpCar(int enterpriseId, String username, CustomerTpCar tpCar);

	int deleteCustomerTpCar(int enterpriseId, String username, int customerId, int id);

	List<CustomerTpCar> searchCustomerTpCars(int enterpriseId, SearchCustomerCriteria sc);
	List<CustomerTpCar> searchCustomerTpCars(int enterpriseId, int customerId);

	int saveCustomerTpTrain(int enterpriseId, String username, CustomerTpTrain tpTrain);

	int deleteCustomerTpTrain(int enterpriseId, String username, int customerId, int id);

	List<CustomerTpTrain> searchCustomerTpTrains(int enterpriseId, SearchCustomerCriteria sc);

	/**
	 * 查找企业客户所包含的的所有登录信息
	 * @param ownerId 企业客户拥有者的企业id
	 * @param sc
	 * @return
	 */
  List<User> searchCustomerLoginInfos(final int ownerId, SearchCustomerCriteria sc);

  int saveCustomerDepartmentApprover(int enterpriseId, int userId, int customerId, int departmentId, int approverId, int roleType);

  List<CustomerTravelApprover> searchCustomerApprovers(int enterpriseId, int customerId, int departmentId);

	int deleteCustomerDepartmentApprover(int userId, int approverId);

	/**
	 * 停用企业客户
	 * @param id
	 * @param username
	 * @param remark
	 * @return
	 */
	int disableCustomer(int enterpriseId, int id, String username, String remark);

	int saveCustomerSmsMode(int enterpriseId, int userId, int customerId, int smsMode);

  List<CustomerAddress> searchCustomerAddresses(int enterpriseId, int customerId);
}
